The present invention relates to a system and method for processing a compressed data stream.
In recent years, both software and hardware technologies have experienced amazing advancement. These technologies have benefited not only traditional computers, but also various kinds of household appliances, such as VCD players, MP3 players, etc. With the new technology, more and more functions are added and greater convenience is provided as people use these electronic appliances.
One of the most noticeable changes introduced by recent computer technology is the inclusion of images, video, and audio to enhance the previous text-only user interfaces. In the age of multimedia, the amount of information to be processed increases greatly, particularly in such applications as digital movies and remote learning. Therefore, processing very large amounts of information is a key problem to solve in many new multimedia applications.
One popular method of handling large data files is to compress the data for storage or transmission. Different kinds of data are typically compressed using different methods. For image data, common compression methods include JPEG, GIF, and PCF. For video and audio data, common methods include MP3, RealAudio, MPEG and AVI. For digital data and executable instructions, common compression methods include ZIP, ARJ, and TAR. These methods of compression can be classified into two categories, lossy compression and non-lossy compression. In the former category, natural characteristics of the compressed data are found and a level of information accuracy of data is sacrificed to produce a higher compression ratio. By utilizing lossy compression methods, many new multimedia applications, such as video on demand, overcoming limitations on bandwidth and becoming increasingly popular.
Scientists continue to seek better compression methods to reach higher and higher compression ratios. A common result, however, is that as a method produces a higher compression ratio, the associated complexity and cost to implement the method tend to increase. Now we will briefly explain a popular lossy method, MPEG, to give a clearer idea on compression methods of the multimedia age.
MPEG is the abbreviation of xe2x80x9cMoving Picture Experts Groupxe2x80x9d. It represents a group of international standards, such as MPEG 1 and MPEG 2. Most conventional video CD-ROMs, including VCDs and DVDs, adopt MPEG compression techniques. In the case of a movie, the data are typically separated as a video data stream and an audio data stream, and both data streams are compressed with MPEG compression.
Please refer to FIG. 1(A). FIG. 1(A) shows an example of multimedia data. The multimedia data 111 comprise a video data stream 112 and an audio data stream 113. To play the multimedia data 111 properly, time parameters of the video data stream 112 and the audio data stream 113 are synchronized. Theoretically, more than two data streams may be combined together to provide higher resolution, and each data stream may be compressed separately.
In the MPEG video compression technique, an intra-frame compression and an inter-frame compression are both used to acquire the best compression effect. First, we explain the intra-frame compression. Video data is composed of a series of frames. To provide an effect of persistence of vision, thirty frames are typically shown each second. The MPEG video compression includes steps of color plane sampling, discrete cosine transform (DCT), numerical sampling, zig-zag, and dynamic length compression encoding.
Please refer to FIG. 1(B). In a typical computer graphical environment, video data of a frame are recorded as arrays of pixels, and each pixel can be described as having red, green, or blue color (RGB). Scientists have found that human eyes are less sensitive to changes in color, however, and therefore people perceive little or no effect of video data lost due to the luminance attribute of the pixels. The MPEG method involves transferring RGB to YUV data where Y is a luminance plane and U and V are chrominance planes. Taking 16*16 pixels as a macro block, the transformation radio of RBG to YUV planes is typically 4:1:1 (step 121). By using the color plane sampling, the amount of data is reduced.
Please refer to FIG. 1(B). Next, for each YUV block that has 8xc3x978 pixels, discrete cosine transformation (step 122) is performed. After the transformation, the data of each block is quantized by different criterion of quantization according to different needs (step 123).
After the transformation and the quantizing of each block, the two dimension data is scanned into one dimension data in a zig-zag direction as shown in FIG. 1(C). Next, one performs a dynamic length compression encoding, such as Huffman encoding, to the one dimension array (step 124).
Besides the intra-frame compression mentioned above, the MPEG video compression method obtains a higher compression ratio by incorporating inter-frame compression. The inter-frame compression is most effective when video data streams in neighboring frames have strong resemblance to each other. This resemblance can be used to reduce the data volume of the video stream. Please refer to FIG. 1(D). A frame can be considered as a combination of a plurality of blocks. Each block is composed of a fixed number of pixels, such as 8xc3x978 pixels. For the N frame 131 that is to be encoded, the system searches for a similar image in Nxe2x88x921 reference frame 132. If a block 134 in Nxe2x88x921 reference frame 132 that is similar to a block 133 in the N frame 131 can be found, the block 133 can be described as block 134 plus a vector 135. Compared to storing a whole block data, a representation of another block in a referenced frame plus a vector will greatly reduce the volume of data. More importantly, in video data, since neighboring frames have high levels of similarity, sacrificing some accuracy to obtain a very high compression ratio is very powerful. This method is referred to as a xe2x80x9clossyxe2x80x9d compression method.
As shown in FIG. 1(D), frame N is encoded by reference to the preceding frame Nxe2x88x921. In such case, the frame N is referred to as a xe2x80x9cP framexe2x80x9d. The MPEG technique refers to a P frame, an I frame and a B frame. The I frame refers to no other frames, the P frame refers to previous frame, and the B frame refers to a previous frame and a latter frame. FIG. 1(E) shows a frame series of a MPEG video stream that is composed of I, P, and B frames in a predetermined sequence.
After the intra-frame compression and the inter-frame compression, the video compressed data and the audio compressed data are divided into packets and then recombined together in a predetermined sequence to form an MPEG data stream as shown in FIG. 1(F). Because dynamic length encoding is utilized in MPEG encoding, I, P, and B frames may be constituted by different numbers of packets. Playback or editing applications read the packets to acquire necessary data for further processing. Each packet has a packet header to record necessary information of the packet. An example of the information stored in the packet header is the time information. The time information in the packet header can be used to synchronize different channels, such as the video and sound channels. Therefore, a multimedia effect is presented after processing using an MPEG technique. Further information may be found by reference to the ISO/IEC 11172 and ISO/IEC 13818 standards.
To reduce the huge amount of data in multimedia applications, adopting rather complicated compression methods such as the MPEG method described above may resolve problems of storage and transmission of data. Because such compression methods are complicated, however, the process of compressing data takes a relatively long time. Furthermore, when the data is needed for playback or editing, a decompression must be performed on the compressed data before hand. Processing time becomes a more important factor when considering large multimedia data such as video streams.
Furthermore, for lossy compression methods that bring higher compression ratios, as each time the compression and decompression process is performed, the accuracy of data is undermined, a phenomenon known as xe2x80x9cerror propagationxe2x80x9d. In the compression methods of MPEG video streams, for example, because intra-frame compression or inter-frame compression are both lossy compression, after several times of decompression and recompression on a video stream, the quality of the video stream may deteriorate. Therefore, error propagation is a serious side-effect of lossy compression.
If each manipulation of stored data requires compression and decompression prior to use or edit, much processing time may be wasted. Even worse, if the data is compressed with a lossy compression technique, then the quality of the data may degrade quickly with multiple uses. Moreover, the quality of the entire data file may become degraded even if only a portion is used or edited.
It is therefore one aspect of the present invention to provide a system and method for efficiently processing compressed data to reduce data inaccuracy.
The first embodiment of the present invention includes a dispatching unit, a first processing unit, a second processing unit, and an integrating unit. The dispatching unit is used to separate a source compressed data stream into a first group of source segments and a second group of source segments. The first group of source segments are only necessary to selectively modify a status, like timestamp, by the first processing unit to generate a first group of target segments. For the first group of segments, operations of decompression and recompression are not generally taken.
A second processing unit includes a decompressing unit, an operating unit, and a recompressing unit. The first group of source segments are firstly decompressed by the decompressing unit to generate a second group of uncompressed source segments. As the second group of source segments second group are decompressed, the operating unit may change the content. Exemplary change includes adding data, directing an operation to follow a rule, or mixing a parameter data segment decompressed from other compressed data streams. After the operation of the operating unit, a second group of uncompressed target segments are obtained. The second group of uncompressed target segments are then recompressed by the recompressing unit to generate a second group of target segments.
The first group of target segments and the second group of target segments are then combined by the integrating unit to generate a target compressed data stream.
The system is able to save time significantly because unnecessary decompression and recompression operations are skipped. Furthermore, error propagation is reduced at the same time.
The present invention is also applicable to operate inter-frame compression in MPEG video streams. For frames that are not used, decompression and recompression operations are not taken. Therefore, efficiency can be improved, and unnecessary accuracy loss can be avoided.